<%--
  Created by IntelliJ IDEA.
  User: 19143
  Date: 2021/10/25
  Time: 16:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%String path = request.getContextPath();%>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑订单</title>
    <link type="text/css" rel="stylesheet" href="fontsawesome/css/font-awesome.css"/>
    <link type="text/css" rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div class="main_box">
    <div class="cont_box">
        <!--订单号-->
        <div class="user_top">订单号：<span>${l.bid}</span></div>
        <!--订单商品-->
        <div class="user_top order_top">订单商品：</div>
<c:forEach items="${pname}" var="p">
    <input type="hidden" name="${p.bid}">
        <table border="0" cellspacing="0" cellpadding="0" class="table">
            <thead>
            <tr>
                <th>商品名称</th>
                <th>商品价格</th>
                <th>商品实际销售价格</th>
                <th>销售人员</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>${p.pname}</td>
                <td>${p.money}</td>
                <td>${p.smoney}</td>
                <td>${p.ename}</td>
                <td>
                    <a href="javascript:void(0);" class="table_btn table_del del_btn" onclick="pname(this,${p.bid})">
                        <i class="fa fa-trash-o"></i>
                        <span>删除</span>
                    </a>
                </td>
            </tr>
            </tbody>
        </table>
</c:forEach>
        <div class="clearfix" style="margin-top:20px;">
            <form action="${pageContext.request.contextPath}/Ename">
                <input type="hidden" name="vid" value="${l.vid}">
            <input type="submit" value="添加商品" class="btn line_btn">
            </form>
        </div>
        <!--订单服务-->
        <div class="user_top order_top">订单服务：</div>
<c:forEach items="${sname}" var="s">
    <input type="hidden" name="${s.bid}">
        <table border="0" cellspacing="0" cellpadding="0" class="table pre_table">
            <thead>
            <tr>
                <th>服务名称</th>
                <th>服务价格</th>
                <th>服务实际支付价格</th>
                <th>施工人员</th>
                <th>销售人员</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>
                    <c:choose>
                        <c:when test="${s.sname=='1'}">陶瓷镀膜（世界上超五百万辆在使用）</c:when>
                        <c:when test="${s.sname=='2'}">房车清洗</c:when>
                        <c:when test="${s.sname=='3'}">驾驶舱气触媒空气治理A+雾化气触媒B+消毒车美容人健康</c:when>
                        <c:when test="${s.sname=='4'}">喷晶镀膜（比封釉更经济实惠的镀膜，快速施工）</c:when>
                        <c:when test="${s.sname=='5'}">洗车</c:when>
                        <c:when test="${s.sname=='6'}">检查</c:when>
                        <c:when test="${s.sname=='7'}">拆车</c:when>
                        <c:when test="${s.sname=='8'}">贴膜</c:when>
                </c:choose>
                </td>
                <td>${s.money}</td>
                <td>${s.smoney}</td>
                <td>${s.shigong}</td>
                <td>${s.ename}</td>
                <td>
                    <a href="javascript:void(0);" class="table_btn table_del del_btn" onclick="sname(this,${s.bid})">
                        <i class="fa fa-trash-o"></i>
                        <span>删除</span>
                    </a>
                </td>
            </tr>
            </tbody>
        </table>
</c:forEach>
        <div class="clearfix" style="margin-top:20px;">
            <form action="${pageContext.request.contextPath}/Pname">
                <input type="hidden" name="vid" value="${l.vid}">
            <input type="submit" value="添加服务" class="btn line_btn">
            </form>
        </div>
        <!--订单备注-->
        <form action="${pageContext.request.contextPath}/updateBilling" method="post">
            <input type="hidden" value="${l.bid}" name="bid">
        <div class="user_top order_top">订单备注：</div>
        <textarea class="order_note" name="remark">${l.remark}</textarea>
        <div class="clearfix" style="margin-top:20px;">
            <input type="submit" value="确认保存" class="btn blue_btn total_btn">
        </div>
        </form>
    </div>
</div>
<!--javascript include-->
<script src="js/jquery-2.2.1.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script src="js/other.js"></script>
<script>
    $(function(){
        tableShow();
        $(".del_btn").click(function(){
            if($(this).parents("tbody").find("tr").length<=1){
                $(this).parents(".table").prev().remove();
                $(this).parents(".table").remove();
            }else{
                $(this).parents("tr").remove();
            }
        });
    });
    function tableShow(){
        $(".table").each(function(){
            if($(this).find("tbody tr").length<=0){
                $(this).prev().remove();
                $(this).remove();
            }
        });
    }
    function pname(obj,id){
        location.href="<%=path%>/deleteSnamePname?bid="+id
    }
    function sname(obj,id){
        location.href="<%=path%>/deleteSnamePname?bid="+id
    }
</script>
</body>
</html>